{% extends "base_step.html" %}
{% load i18n %}
{% load lp_extras %}
{% block content %}
{% if error_msg %}<div class="error_msg">{{ error_msg }}</div>{% endif %}
<input type="hidden" name="style" value="{{ inputstyle }}">
<table id="lptable">
<tr>
<td>{{ ulp.objtype }} {{ ulp.objname }}(x) =</td>
<td>
<input type="text" name="obj_func" value="{% for i, j in ulp.obj_func %} {{ i }} {{ j }}x{{ forloop.counter }}{% endfor %}" size="{{ ulp.n|obj_func_width:ulp.obj_func }}" maxlength="1024" />
</td>
</tr>

<tr><td colspan="2">
</td></tr>

<tr>
<td></td>
<td>
<textarea name="const_area" rows="{{ ulp.m|const_height }}" cols="{{ ulp.n|const_width:ulp.const_l }}">
{% for i in ulp.const_r %}{% for j, k in ulp.const_l|list_nest:forloop.counter0 %} {{ j }} {{ k }}x{{ forloop.counter }}{% endfor %} {{ i.0 }} {{ i.1 }}
{% endfor %}
</textarea>
</td>
</tr>

<tr><td colspan="2">
</td></tr>

<tr><td></td><td>
{% if ulp.nonzero %}x<span class="index">i</span> &ge; 0 (i = 1 ... {{ n }})<br />{% endif %}
{% if ulp.binary %}x<span class="index">i</span> &isin; {0, 1} (i = 1 ... {{ n }})<br />{% endif %}
{% if ulp.integer %}x &isin; N<br />{% endif %}
</td></tr>
</table>

<div class="buttons">
<input type="button" value="{% trans "Back" %}" onClick="window.location.replace('{% url lp.lpx.views.step1 project.id %}');" />
<input type="submit" name="submit_action" value="{% trans "Next" %}" />
</div>

<script type="text/javascript">
var NumIn = document.getElementsByTagName("input");

function dynsize(e) {
    if (this.value.length > this.size && this.size < 32) {
	this.size++;
    }
    if (this.value.length < this.size && this.size > 4 && this.size < 32) {
	this.size--;
    }
}

for (var i=0; i < NumIn.length; i++) {
    NumIn[i].onkeyup = dynsize;
    NumIn[i].onkeydown = dynsize;
    NumIn[i].onkeypress = dynsize;
    NumIn[i].onchange = dynsize;
}
</script>

{% endblock content %}
